//
//  PTStuLSReleaseDetailJobInfoCell.m
//  PlanTech
//  发布详情-服务信息
//  Created by ruifeng song on 2018/7/12.
//  Copyright © 2018年  androidlongs. All rights reserved.
//

#import "PTStuLSReleaseDetailJobInfoCell.h"

@implementation PTStuLSReleaseDetailJobInfoCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = [UIColor clearColor];
        
        UIView * backView = [[UIView alloc]initWithFrame:CGRectMake(12, 10, ScreenWidth -24, 99)];
        backView.layer.cornerRadius = 6;
        backView.layer.masksToBounds = YES;
        backView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:backView];
        
        _serviceContentLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(20,20,ScreenWidth - 40 - 24, 12)];
//        _serviceContentLabel1.text = @"快递点：东门甚么什么神东门";
        _serviceContentLabel1.font = PTFONT_12;
        _serviceContentLabel1.textColor = PTColor_2e2e2e;
        [backView addSubview:_serviceContentLabel1];
        
        _serviceContentLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(20,_serviceContentLabel1.bottom + 13, _serviceContentLabel1.width, 12)];
//        _serviceContentLabel2.text = @"取货码：2658962";
        _serviceContentLabel2.font = PTFONT_12;
        _serviceContentLabel2.textColor = PTColor_2e2e2e;
        [backView addSubview:_serviceContentLabel2];
        
        _rewardLabel = [[UILabel alloc]initWithFrame:CGRectMake(20,_serviceContentLabel2.bottom + 13, _serviceContentLabel2.width, 12)];
//        _rewardLabel.text = @"酬金：8RMB";
        _rewardLabel.font = PTFONT_12;
        _rewardLabel.textColor = PTColor_2e2e2e;
        [backView addSubview:_rewardLabel ];
    }
    return self;
}

-(void)updateMyReleaseJobInfoCell:(LifeServiceListDetailModel *)detailModel
{
    if (detailModel == nil) {
        return;
    }
    
    NSString * serviceContentStr = @"";
    NSString * userAddressStr = @"";
    NSString * serviceName = @"";
    NSString * serviceAddress = @"";
    
    if ([detailModel.type integerValue] ==PTLifeService_ExpressType ) {
        
        serviceContentStr = @"快递点：";
        userAddressStr = @"取货码：";
        serviceName = detailModel.destinationAddress;
        if (detailModel.accessCode == nil) {
            detailModel.accessCode = @"";
        }
        serviceAddress = [NSString stringWithFormat:@"%@", detailModel.accessCode];
    }else if ([detailModel.type integerValue] ==PTLifeService_PrintType)
    {
        serviceContentStr = @"打印份数：";
        userAddressStr = @"打印地点：";
        if (detailModel.copies ==nil) {
            detailModel.copies = [NSNumber numberWithInteger:0];
        }
        serviceName = [NSString stringWithFormat:@"%@",detailModel.copies];
        serviceAddress = detailModel.destinationAddress;
    }
    else if ([detailModel.type integerValue] ==PTLifeService_BuyMealType)
    {
        serviceContentStr = @"餐厅名称：";
        userAddressStr = @"餐厅地址：";
        serviceName = detailModel.destinationName;
        serviceAddress = detailModel.destinationAddress;
    }
    else if ([detailModel.type integerValue] ==PTLifeService_HotboomType)
    {
        serviceContentStr = @"超市名称：";
        userAddressStr = @"超市地点：";
        serviceName = detailModel.destinationName;
        serviceAddress = detailModel.destinationAddress;
    }
    
    self.serviceContentLabel1.text = [NSString stringWithFormat:@"%@%@",serviceContentStr,serviceName];
    
    self.serviceContentLabel2.text = [NSString stringWithFormat:@"%@%@",userAddressStr,serviceAddress];
    
    self.rewardLabel.text =[NSString stringWithFormat:@"酬金：%@RMB",detailModel.reward];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
